package com.group.eams.threadlocal;

/**
 * com.group.eams.threadlocal
 * User: hfs
 * Date: 2024/11/01 20:13
 * Description:
 * Version: V1.0
 */
public class UserThreadLocal {
    private static final ThreadLocal<UserThreadLocalDto> tl=new ThreadLocal<>();
    /**
     * 绑定用户信息到当前线程
     * @param userThreadLocalDto
     */
    public static void set(UserThreadLocalDto userThreadLocalDto){
        tl.set(userThreadLocalDto);
    }


    /**
     * 获取当前线程绑定的用户信息
     * @return
     */
    public static UserThreadLocalDto get(){
        return tl.get();
    }

    /**
     * 移除当前线程绑定的用户信息
     */
    public static void remove(){
        tl.remove();
    }


}
